﻿namespace TriangleGames.TrainRes
{
    using System;
    using System.ComponentModel;

    //[TypeConverter(typeof(EnumToStringUsingDescription))]
    public enum ActionCategory
    {
        [Description("动画")]
        动画,//Animation,
        [Description("声音")]
        声音,//Audio,
        [Description("调试")]
        调试,//Debug,
        [Description("事件")]
        事件,//Events,
        //[Description("游戏对象")]
        //GameObject,
        //[Description("图形界面")]
        //GUI,
        //[Description("输入")]
        //Input,
        //[Description("数学")]
        //Math,
        [Description("移动")]
        移动,//Movement,
        //[Description("物理")]
        //Physics,
        //[Description("渲染")]
        //Renderer,
        //[Description("脚本控制")]
        //ScriptControl,
        //[Description("状态机")]
        //StateMachine,
        [Description("特效")]
        特效,//Effects,
        [Description("变换")]
        变换,//Transform,
        //[Description("游戏逻辑")]
        //GameLogic,
        //[Description("字符串")]
        //String,
        //[Description("转换")]
        //Convert,
        //[Description("图形界面元素")]
        //GUIElement,
        //[Description("向量")]
        //Vector3,
        [Description("材质")]
        材质,//Material,
        //[Description("灯光")]
        //Lights,
        [Description("镜头")]
        镜头,//Camera,
        //[Description("渲染设置")]
        //RenderSettings,
        [Description("颜色")]
        颜色,//Color,
        //[Description("关卡")]
        //Level,
        //[Description("图形界面层")]
        //GUILayout,
        //[Description("逻辑")]
        //Logic,
        //[Description("世界")]
        //World,
        //[Description("屏幕")]
        //Screen,
        //[Description("电影")]
        //Movie,
        [Description("时间")]
        时间,//Time,
        //[Description("角色")]
        //Character,
        //[Description("设备")]
        //Device,
        //[Description("控制器")]
        //Controller,
        //[Description("角色控制器")]
        //CharacterController,
        [Description("iTween")]
        iTween,
        //[Description("动画变量")]
        //AnimateVariables,
        //[Description("输入设备")]
        //InputDevice,
        //[Description("矩形")]
        //Rect,
        //[Description("Unity对象")]
        //UnityObject,
        //[Description("应用程序")]
        //Application,
        //[Description("寻路网格")]
        //NavMesh,
        //[Description("寻路代理")]
        //NavMeshAgent,
        //[Description("网络")]
        //Network
    }

    //public class EnumToStringUsingDescription : TypeConverter
    //{
    //    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
    //    {
    //        return (sourceType.Equals(typeof(Enum)));
    //    }

    //    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
    //    {
    //        return (destinationType.Equals(typeof(String)));
    //    }

    //    public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
    //    {
    //        return base.ConvertFrom(context, culture, value);
    //    }

    //    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
    //    {
    //        if (!destinationType.Equals(typeof(String)))
    //        {
    //            throw new ArgumentException("Can only convert to string.", "destinationType");
    //        }

    //        if (!value.GetType().BaseType.Equals(typeof(Enum)))
    //        {
    //            throw new ArgumentException("Can only convert an instance of enum.", "value");
    //        }

    //        string name = value.ToString();
    //        object[] attrs = value.GetType().GetField(name).GetCustomAttributes(typeof(DescriptionAttribute), false);
    //        return (attrs.Length > 0) ? ((DescriptionAttribute)attrs[0]).Description : name;
    //    }
    //} 
}

